package com.fy.oa.zc.manager;

import java.util.Map;

import org.springframework.jdbc.core.JdbcTemplate;

public class FyOA_CommQueryManagerImpl implements FyOA_CommQueryManager {

	private JdbcTemplate jdbcTemplate;
	private Map<String, String> sqlMap;

	@Override
	public FyOA_CommQueryResultBean query(String name, Object[] args) {
		String sql = sqlMap.get(name);
		FyOA_CommQueryResultBean bean = new FyOA_CommQueryResultBean();
		if (sql != null) {
			Map<String, Object> result = jdbcTemplate.queryForMap(sql, args);
			bean.setSuccess(true);
			bean.setResult(result);
		}
		bean.setSuccess(false);
		return bean;
	}

	@Override
	public void setSQLMap(Map<String, String> sqlMap) {
		this.sqlMap = sqlMap;
	}

	@Override
	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}

}
